﻿using Antlr.Runtime;
using BizModels;
using BizModels.Common;
using IRepositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Repositories;

namespace HinokyWeb.Controllers
{
    public class HomeController : Controller
    {
        private ICategoryRepository _categoryRepository;
        private IBoardRepository _boardRepository;
        private IMainKeywordRepository _mainKeywordRepository;

        public HomeController()
        {
            _categoryRepository = new CategoryRepository();
            _boardRepository = new BoardRepository();
            _mainKeywordRepository = new MainKeywordRepository();
        }

        public ActionResult GetMainKeywordList()
        {
            var mainKeywordList = _mainKeywordRepository.GetMainKeywordList(false);

            var jsonKeywordList = (from s in mainKeywordList
                                 select new
                                 {
                                     s.Keyword,
                                     s.LinkUrl,
                                     s.LinkTarget,
                                     s.Size,
                                     s.Color
                                 }).ToList();

            return Json(new { KeywordData = jsonKeywordList }, JsonRequestBehavior.AllowGet);
        }

        public ActionResult ContractUs()
        {
            return View();
        }
    }
}
